package lec03.am;

public class InstanceofDemo {
	public static void main(String[] args) {
		Object a = new A();
		Object b = new B();
		System.out.println(a instanceof Object);
		System.out.println(b instanceof Object);
		System.out.println(a instanceof A);
		System.out.println(b instanceof B);
		
		a=b;		
		System.out.println(a instanceof A);
		System.out.println(b instanceof B);
		
		if(a instanceof A && b instanceof A)
		{
			A pa=(A)a;
			A pb=(A)b;
			//....
		}
	}
}
